﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using ATM;

namespace ATM_Test
{
    [TestFixture]

   public class accounts_test
    {

        // depositcall test
        [Test]
        public void Deposit_testIn()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("500", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(1, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testAT()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("10000", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(1, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testAT2()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("10", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(1, acount.checkforBAL);

        }

        [Test]
        public void Deposit_testOutwithNull()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall(null, "123");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testOutwithNegativeValue()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("-100", "123");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testOutBigger()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("1000000", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testOutLess()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("9", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testOutcharacters()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("dsdsafas", "123");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testOutNull2()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("500", null);
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testOutcharacters2()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("500", "sasdsad");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);

        }
        [Test]
        public void Deposit_testOutNegativeValue2()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("dsadsa", "-1");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
        }

        [Test]
        public void Deposit_testOutempty()
        {
            AccountLogic acount = new AccountLogic();
            acount.deposcall("", "");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
        }



        // Withdraw TEST
        [Test]
        public void Withdraw_testIn()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("500", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(1, acount.checkforBAL);
            Assert.AreEqual(1, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testAT()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("5000", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(1, acount.checkforBAL);
            Assert.AreEqual(1, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testAT2()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("10", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(1, acount.checkforBAL);
            Assert.AreEqual(1, acount.lessBalan);
        }

        [Test]
        public void WithDraw_testOutwithNull()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall(null, "123");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testOutwithNegativeValue()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("-100", "123");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testOutbigger()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("1000000", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testOutless()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("9", "123");
            Assert.AreEqual(1, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testOutcharacters()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("dsdsafas", "123");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testOutNull2()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("500", null);
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testOutcharacters2()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("500", "sasdsad");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }
        [Test]
        public void WithDraw_testOutNegativeValue2()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("dsadsa", "-1");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }

        [Test]
        public void WithDraw_testOutEmpty()
        {
            AccountLogic acount = new AccountLogic();
            acount.wdrcall("", "");
            Assert.AreEqual(0, acount.ch);
            Assert.AreEqual(0, acount.checkforBAL);
            Assert.AreEqual(0, acount.lessBalan);

        }
        /* [Test]
         public void WithDraw_testOut9()
         {
             AccountLogic acount = new AccountLogic();
             acount.wdrcall("5000", "123");
             Assert.AreEqual(1, acount.ch);
             Assert.AreEqual(1, acount.checkforBAL);
             Assert.AreEqual(0, acount.lessBalan);

         }*/



        // Login TEST
        [Test]
        public void Login_testIn()
        {
            AccountLogic account = new AccountLogic();
            account.calllog("123");
            Assert.AreEqual(1, account.ch);
            Assert.AreEqual(1, account.check);
        }

        [Test]
        public void Login_testOutNull()
        {
            AccountLogic account = new AccountLogic();
            account.calllog(null);
            Assert.AreEqual(0, account.ch);
            Assert.AreEqual(0, account.check);
        }

        [Test]
        public void Login_testOutNegative()
        {
            AccountLogic account = new AccountLogic();
            account.calllog("-155");
            Assert.AreEqual(0, account.ch);
            Assert.AreEqual(0, account.check);
        }

        [Test]
        public void Login_testOutcharachter()
        {
            AccountLogic account = new AccountLogic();
            account.calllog("dsadasd");
            Assert.AreEqual(0, account.ch);
            Assert.AreEqual(0, account.check);
        }

        [Test]
        public void Login_testOutEmpty()
        {
            AccountLogic account = new AccountLogic();
            account.calllog("");
            Assert.AreEqual(0, account.ch);
            Assert.AreEqual(0, account.check);
        }

        [Test]
        public void getBalanceTestNormal()
        {
            AccountLogic al = new AccountLogic();
            float actB = al.GetBalance(123);
            Assert.AreEqual(500, actB);
        }

        [Test]
        public void getBalanceTestMinus()
        {
            AccountLogic al = new AccountLogic();
            float actB = al.GetBalance(-12);
            Assert.AreEqual(-1, actB);
        }

    }
}
